<?php
function smarty_function_star($params, &$smarty)
{
	$intPoint 	= isset($params['point']) ? $params['point'] : 0;
	$intPerson	= isset($params['person']) ? $params['person'] : 0;
	$intLimit	= isset($params['slimit']) ? $params['slimit'] : 5;
	$intResult	= isset($params['result']) ? $params['result'] : 1;
	$intType	= isset($params['type']) ? $params['type'] : 0;
	$intExp		= 0;
	if(!$intPerson)
		$intStar = 0;
	else
		$intStar	= ($intPoint/$intPerson);	
	if($intStar > $intLimit) $intStar = $intLimit;
	if($intStar > 0) {
		$expStar	= explode('.',$intStar);
		$intExp		= $expStar[1] >= 5 ? 0.5 : 0;
		$intStar	= (int)$intStar;
		
	}		
	$smarty->assign('intStar',		$intStar);
	$smarty->assign('intExp',		$intExp);
	$smarty->assign('intSlimit',		$intLimit);
	$smarty->assign('intPoint',		$intPoint);
	$smarty->assign('intPerson',	$intPerson);
	$smarty->assign('intResult',	$intResult);
	$smarty->assign('intType',		$intType);
	$smarty->display(ROOT_DIR . '/library/Vfriend/Plugins/Tpl/star.tpl');
}
?>
